﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MantisCommon.Settings
{
    public partial class MySettingsControl : Common.Controls.SettingsControl
    {
        public override string this[string key]
        {
            get
            {
                if (!String.IsNullOrEmpty(key))
                {
                    switch (key.ToUpperInvariant())
                    {
                        case "URL":
                            return MantisUrl;
                        case "HTTPUSERNAME":
                            return MantisHttpUsername;
                        case "HTTPPASSWORD":
                            return MantisHttpPassword;
                        case "USERNAME":
                            return MantisUsername;
                        case "PASSWORD":
                            return MantisPassword;
                        case "PROJECT":
                            return Project;
                    }
                }

                return null;
            }

            set
            {
                if (!String.IsNullOrEmpty(key))
                {
                    switch (key.ToUpperInvariant())
                    {
                        case "URL":
                            MantisUrl = value;
                            break;
                        case "HTTPUSERNAME":
                            MantisHttpUsername = value;
                            break;
                        case "HTTPPASSWORD":
                            MantisHttpPassword = value;
                            break;
                        case "USERNAME":
                            MantisUsername = value;
                            break;
                        case "PASSWORD":
                            MantisPassword = value;
                            break;
                        case "PROJECT":
                            Project = value;
                            break;
                    }
                }
            }
        }

        public String MantisUrl
        {
            get { return txtMantisUrl.Text; }
            set { txtMantisUrl.Text = value; }
        }

        public String MantisUsername
        {
            get { return txtMantisUsername.Text; }
            set { txtMantisUsername.Text = value; }
        }

        public String MantisPassword
        {
            get { return txtMantisPassword.Text; }
            set { txtMantisPassword.Text = value; }
        }

        public String MantisHttpUsername
        {
            get { return txtMantisHttpUsername.Text; }
            set { txtMantisHttpUsername.Text = value; }
        }

        public String MantisHttpPassword
        {
            get { return txtMantisHttpPassword.Text; }
            set { txtMantisHttpPassword.Text = value; }
        }

        public String Project
        {
            get { return cboProject.Text; }
            set { cboProject.Text = value; }
        }

        public MySettingsControl()
        {
            InitializeComponent();
        }

        private void btnTest_Click(object sender, EventArgs e)
        {

        }
    }
}
